import 'package:flutter/material.dart';
import 'package:flutter_module/map/models/ni_options_model.dart';
import 'package:flutter_module/map/ni_map_view.dart';
import 'package:flutter_module/system/log_util.dart';
import 'package:flutter_module/viewModels/drawer_manager_viewmodel.dart';
import 'package:flutter_module/viewModels/map_control_viewmodel.dart';
import 'package:flutter_module/views/mapFragmentWidgets/map_control_buttons.dart';
import 'package:flutter_module/views/mapFragmentWidgets/map_foresight.dart';
import 'package:flutter_module/views/mapFragmentWidgets/map_title_bar.dart';
import 'package:provider/provider.dart';

import '../mapFragmentWidgets/map_bottom_drawer.dart';
import '../mapFragmentWidgets/map_new_data_button.dart';

///地图主页布局
class MapFragment extends StatelessWidget {
  const MapFragment({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    LogUtil.instance.printf("jingo 主地图页面 build");
    return MultiProvider(
      providers: [
        ChangeNotifierProvider<DrawerManagerViewModel>(
            create: (_) => DrawerManagerViewModel()),
        ChangeNotifierProvider<MapControlViewModel>(
            create: (_) => MapControlViewModel()),
      ],
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        body: Stack(
          children: [
            NIMapViewWidget(
              mapOptions: NIMapOptions(showZoomControl: false),
            ),
            const MapTitleBarWidget(),
            const MapControlButtons(),
            const MapForesightWidget(),
            const MapBottomDrawer(top: 86),
          ],
        ),
        floatingActionButton: const MapNewDataButton(),
      ),
    );
  }
}
